Dijital LPG Gösterge Kodu
Merhabalar. Aşağıdaki kodu yüklediğimde şu hatayı alıyorum ;
C:\Users\PC\Documents\Arduino\sketch_aug11a\sketch_aug11a.ino:7:26: fatal error: LiquidCrystal: No such file or directory
#include <LiquidCrystal>
^
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
Kod ise :
#define lenght 20.0
double percent=105.0;
unsigned char b;
unsigned int peace;
#include <LiquidCrystal_I2C_Avrl2C.h>
LiquidCrystal_I2C_Avrl2C lcd(0x3F,20,4); //
byte P1[8] = {
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
};
byte P2[8] = {
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
byte P3[8] = {
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
};
byte P4[8] = {
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
};
byte P5[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
};
void setup() {
lcd.begin();
lcd.createChar(0,P1);
lcd.createChar(1,P2);
lcd.createChar(2,P3);
lcd.createChar(3,P4);
lcd.createChar(4,P5);
}
void loop() {
int i;
lcd.setCursor(0,2);
unsigned int value = analogRead(0);
percent = value/1023.0*105.0;
lcd.print('Gaz:");
lcd.setCursor(4,2);
lcd.print(value/29.0);
lcd.print(' ');
lcd.setCursor(13,2);
lcd.print(value/3);
lcd.print(' ');
lcd.setCursor(10,2);
lcd.print('Lt');
lcd.setCursor(17,2);
lcd.print('Km.');
delay(1);
lcd.setCursor(0,3);
double a=lenght/100*percent;
if(a>=1) {
for(int i=1;i<a;i++) {
lcd.write(4);
b=i;
}
a=a-b;
}
peace=a*5;
switch(peace)
{
case 4;
case 3;
case 2;
case 1;
case 0;
;}
for(int i=0;i<(lenght-b);i++){
lcd.print(">');
}}
}
}
}
Arduino ve LCD bağlı,LCD'ye yazı yazabiliyorum. Ancak bu kodda sorun çıkıyor.